
import { request, reques } from "../src/assets/utils/request.js";

//轮播图
async function getlunbotu() {
    let res = await request("https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata").then(res => res)
    return res.data.message
}
//新闻列表
async function newslist() {
    let res = await request("http://www.liulongbin.top:3005/api/getnewslist").then(res => res)
    return res.data.message
}
//新闻详情
async function newsdetail(id) {
    let res = await request(`http://www.liulongbin.top:3005/api/getnew/${id}`).then(res => res)
    return res.data.message[0]
}
//评论列表
async function pinglun(id, page) {
    let res = await request(`http://www.liulongbin.top:3005/api/getcomments/${id}?pageindex=${page}`).then(res => res)
    return res.data.message
}
//添加评论
async function addpinglun(id) {
    let res = await reques(`http://www.liulongbin.top:3005/api/postcomment/${id}`).then(res => res)
    return res
}
//图片列表标题
async function piclistitle() {
    let res = await request(`http://www.liulongbin.top:3005/api/getimgcategory`).then(res => res)
    return res.data.message
}
//图片列表
async function piclist(id) {
    let res = await request(`http://www.liulongbin.top:3005/api/getimages/${id}`).then(res => res)
    return res.data.message
}
//图片详情
async function piclistdetail(id) {
    let res = await request(`http://www.liulongbin.top:3005/api/getimageInfo/${id}`).then(res => res)
    return res.data.message
}
//缩略图
async function sulvetu(id) {
    let res = await request(`http://www.liulongbin.top:3005/api/getthumimages/${id}`).then(res => res)
    return res.data.message
}
//商品列表数据
async function goodslist(number) {
    let res = await request(`http://www.liulongbin.top:3005/api/getgoods?pageindex=${number}`).then(res => res)
    return res.data.message
}
//商品图文介绍
async function goodsdetail(id) {
    let res = await request(`http://www.liulongbin.top:3005/api/goods/getdesc/${id}`).then(res => res)
    return res.data.message
}
//购物车数据
async function goodsshop(id) {
    let res = await request(`http://www.liulongbin.top:3005/api/goods/getshopcarlist/${id}`).then(res => res)
    return res.data.message
}
//商品详情
async function goodsprize(id) {
    let res = await request(`http://www.liulongbin.top:3005/api/goods/getinfo/${id}`).then(res => res)
    return res.data.message
}
export { getlunbotu, newslist, newsdetail, pinglun, addpinglun, piclistitle, piclist, piclistdetail, sulvetu, goodslist, goodsdetail, goodsshop, goodsprize }